package com.sjksy.demo.controller;

import com.sjksy.demo.service.LedgerService;
import com.sjksy.demo.vo.ledger.LedgerBranchStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerGuideStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerRouteStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ledger")
@Tag(name = "分类账单接口模块",description = "分类账单与账单数据处理查询相关的接口")
public class LedgerController {

    @Resource
    LedgerService ledgerService;

    @GetMapping("/get_all_ledger")
    @Operation(summary = "获取所有分类帐数据")
    ResponseEntity<List<LedgerVo>> getAllLedger(){
        List<LedgerVo> ledgerVoList=ledgerService.getAllLedger();
        if(ledgerVoList==null){
            return ResponseEntity.notFound().build();
        }else {
            return ResponseEntity.ok(ledgerVoList);
        }
    }

    @GetMapping("/statistic_route_ledger")
    @Operation(summary = "统计路线当月的销售统计")
    ResponseEntity<List<LedgerRouteStatisticVo>> statisticRouteLedger(){
        List<LedgerRouteStatisticVo> ledgerRouteStatisticVoList=ledgerService.statisticRouteLedger();
        if(ledgerRouteStatisticVoList==null){
            return ResponseEntity.notFound().build();
        }else {
            return ResponseEntity.ok(ledgerRouteStatisticVoList);
        }
    }

    @GetMapping("/statistic_guide_ledger")
    @Operation(summary = "统计导游当月的销售统计")
    ResponseEntity<List<LedgerGuideStatisticVo>> statisticGuideLedger(){
        List<LedgerGuideStatisticVo> ledgerGuideStatisticVoList=ledgerService.statisticGuideLedger();
        if(ledgerGuideStatisticVoList==null){
            return ResponseEntity.notFound().build();
        }else {
            return ResponseEntity.ok(ledgerGuideStatisticVoList);
        }
    }

    @GetMapping("/statistic_branch_ledger")
    @Operation(summary = "统计分公司上月的销售统计")
    ResponseEntity<List<LedgerBranchStatisticVo>> statisticBranchLedger(){
        List<LedgerBranchStatisticVo> ledgerBranchStatisticVoList=ledgerService.statisticBranchLedger();
        if(ledgerBranchStatisticVoList==null){
            return ResponseEntity.notFound().build();
        }else {
            return ResponseEntity.ok(ledgerBranchStatisticVoList);
        }
    }

}
